package com.chuangjiangx.member.stored.ddd.query.dto;

import com.chuangjiangx.member.stored.ddd.domain.model.MbrGiftType;

import lombok.Data;
import lombok.ToString;

import java.math.BigDecimal;
import java.util.Date;

@Data
@ToString
public class RechargeRuleByIdDTO {
    /**
     * 储值规则名称
     */
    private String name;

    private String ruleName;

    /**
     * 金额
     */
    private BigDecimal amount;

    /**
     * 赠送积分
     */
    private BigDecimal giftScore;

    /**
     * 赠送金额
     */
    private BigDecimal giftAmount;

    private String giftCoupon;

    private String couponNumber;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 商户id
     */
    private Long merchantId;

    /**
     * 赠送类型
     */
    private Byte giftType;

    @SuppressWarnings("Duplicates")
    public String getRuleName() {
        if (MbrGiftType.AMOUNT.equals(this.giftType)) {
            this.ruleName = "充" + amount + "元赠送" + giftAmount + "元";
        } else if (MbrGiftType.SCROE.equals(this.giftType)){
            this.ruleName = "充" + amount + "元赠送" + giftScore + "积分";
        } else {
            this.ruleName = "充" + amount + "元赠送" + giftCoupon + "券";
        }
        return ruleName;
    }
}
